<template>
	<lee-select-city1
		:getPosition="getPosition"
		@submit="submitHandler"
		@select-current="useCurrentPosition"
	></lee-select-city1>
</template>

<script>
	import LeeSelectCity1 from "@/components/lee-select-city/lee-select-city1.vue"
	export default {
		components: {
	LeeSelectCity1
},
		data() {
			return {
				
			}
		},
		methods: {
			submitHandler({ simple }) {
				// uni.showModal({
				// 	title: '当前选择',
				// 	content: simple.join('-')
				// })
				
				
				uni.showModal({
					title: '当前选择',
					content: simple.join('-'),
					success: function (res) {
						if (res.confirm) {
							let pages = getCurrentPages();
							let prevPage = pages[ pages.length - 2 ];  //上一页页面实例
							//修改上一页data里面的searchVal参数值为1211
							if(simple.length<=1){
								prevPage.$vm.xuan_sheng=simple[0]
								prevPage.$vm.xuan_shi=simple[0]
							}else{
								prevPage.$vm.xuan_sheng=simple[0]
								prevPage.$vm.xuan_shi=simple[1]
							}
							uni.setStorageSync('xuan_sc_type',1)
							uni.navigateBack({
								delta:1
							})
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				});
				
			},
			
			useCurrentPosition(name) {
				uni.showModal({
					title: '使用当前定位',
					content: name
				})
			},
			
			getPosition() {
				return Math.random() > 0.5 ? '爱情公寓' : '爱森公寓'
			}
		}
	}
</script>

<style lang="scss">
	page {
		height: 100%;
		font-family: Demibold;
	}
</style>
